class Solution:
    def longestPalindrome(self, s: str) -> int:
        hash = set()
        r = 0
        for i in s:
            if i in hash:
                hash.remove(i)
                r += 2
            else:
                hash.add(i)
        if len(hash):
            r += 1
        return r


if __name__ == '__main__':
    so = Solution()
    num = "abccccdd"
    r = so.longestPalindrome(num)
    print(r)
